package com.example.activity_service.service.impl;

import com.example.activity_service.dao.Yssdao;
import com.example.activity_service.service.YssQueryService;
import com.example.activity_service.vo.Address;
import com.example.activity_service.vo.Red;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service

public class YssServiceImpl implements YssQueryService {
    @Autowired
    Yssdao yssdao;

    @Override
    public List<Red> searchhb(int users)
    {
        return yssdao.searchhb(users);
    }

    @Override
    public List<Red> searchsyhb(int users) {
        return yssdao.searchsyhb(users);
    }

    @Override
    public List<Red> searchgqhb(int users) {
        return yssdao.searchgqhb(users);
    }



    @Override
    public int updatezt(int id, int status) {
        return yssdao.updatezt(id, status);
    }

    @Override
    public int updateguoqi( ) {
        return yssdao.updateguoqi();
    }

    @Override
    public String chacs(String userid,String nm) {
        return yssdao.chacs(userid, nm);
    }

    @Override
    public List<Red> searchsuoyou() {
        return yssdao.searchsuoyou();
    }

    @Override
    public int deletehb(int id) {
        return yssdao.deletehb(id);
    }


    @Override
    public int tianjiahb(String preferentialway, String parvalue, String threshold, String totalissued, String users) {
        System.out.println(preferentialway);
        System.out.println(parvalue);
        System.out.println(threshold);
        System.out.println(totalissued);
        System.out.println(users);
        return yssdao.tianjiahb(parvalue,threshold,  totalissued+"", users ,Integer.parseInt(preferentialway));
    }

    @Override
    public List<Red> chawei() {
        return yssdao.cahwei();
    }

    @Override
    public void juan(String id, String juan) {
        yssdao.juan(id,juan);
    }

    @Override
    public List<Address> showaddress(String user_id) {
        return yssdao.showaddress(user_id);
    }

    @Override
    public int fanhuics(String id, String nm) {
        return yssdao.fanhuics(id, nm);
    }


    @Override
    public String addhuo(String id,String nm) {
      String s=  yssdao.chacs(id,nm);
        System.out.println(s);
        if (s!=null){
            yssdao.xiuhuo(id,nm);
            return "1";
        }else {
            yssdao.chahuo(id,nm);
            return "0";
        }


    }

    @Override
    public int xiuhuo(String id, String nm) {
      return    yssdao.xiuhuo(id,nm);
    }

    @Override
    public int updatehb(int id, int preferentialway, int parvalue, int threshold, int totalissued) {
        return yssdao.updatehb(id, preferentialway, parvalue, threshold, totalissued);
    }


}
